#region Imported Namespaces



using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;



#endregion


namespace YF.OneNote.DataTypes
{
  [GeneratedCode("xsd", "2.0.50727.1432")]
  [Serializable]
  [DesignerCategory("code")]
  [XmlType(Namespace = "http://schemas.microsoft.com/office/onenote/2007/onenote")]
  [XmlRoot(Namespace = "http://schemas.microsoft.com/office/onenote/2007/onenote", IsNullable = false)]
  public partial class Page: NotesHierarchyNode
  {
    #region Fields



    private readonly NotesNodeCollection<PageObject> _items = new NotesNodeCollection<PageObject>();
    private readonly NotesNodeCollection<MDIFile> _mDIFiles = new NotesNodeCollection<MDIFile>();
    private readonly NotesNodeCollection<MediaReference> _mediaPlaylists = new NotesNodeCollection<MediaReference>();
    private readonly NotesNodeCollection<Meta> _meta = new NotesNodeCollection<Meta>();
    private readonly NotesNodeCollection<TagDef> _tagDef = new NotesNodeCollection<TagDef>();
    private DateTime _dateTime;


    private bool _isCurrentlyViewed;
    private bool _isIndexed;
    private bool _isSubPage;
    private string _lang;
    private PageSettings _pageSettings;
    private string _selected;
    private string _style;
    private Title _title;
    private bool _updateContents;



    #endregion


    #region Properties/Indexers



    [XmlAttribute("dateTime")]
    public DateTime DateTime
    {
      get
      {
        return _dateTime;
      }
      set
      {
        _dateTime = value;
      }
    }

    [XmlAttribute]
    public bool HasContents
    {
      get
      {
        return Title != null;
      }
    }


    [XmlAttribute("isCurrentlyViewed")]
    [DefaultValue(false)]
    public bool IsCurrentlyViewed
    {
      get
      {
        return _isCurrentlyViewed;
      }
      set
      {
        _isCurrentlyViewed = value;
      }
    }


    [XmlAttribute("isIndexed")]
    [DefaultValue(true)]
    public bool IsIndexed
    {
      get
      {
        return _isIndexed;
      }
      set
      {
        _isIndexed = value;
      }
    }


    [XmlAttribute("isSubPage")]
    [DefaultValue(false)]
    public bool IsSubPage
    {
      get
      {
        return _isSubPage;
      }
      set
      {
        _isSubPage = value;
      }
    }


    [XmlElement("Image", typeof(Image))]
    [XmlElement("InkDrawing", typeof(InkDrawing))]
    [XmlElement("InsertedFile", typeof(InsertedFile))]
    [XmlElement("MediaFile", typeof(MediaFile))]
    [XmlElement("Outline", typeof(Outline))]
    public NotesNodeCollection<PageObject> Items
    {
      get
      {
        return _items;
      }
    }


    [XmlAttribute("lang")]
    public string Lang
    {
      get
      {
        return _lang;
      }
      set
      {
        _lang = value;
      }
    }


    [XmlElement("MDIFile")]
    public NotesNodeCollection<MDIFile> MDIFile
    {
      get
      {
        return _mDIFiles;
      }
    }


    [XmlArrayItem(IsNullable = false)]
    public NotesNodeCollection<MediaReference> MediaPlaylist
    {
      get
      {
        return _mediaPlaylists;
      }
    }


    [XmlElement("Meta")]
    public NotesNodeCollection<Meta> Meta
    {
      get
      {
        return _meta;
      }
    }


    public PageSettings PageSettings
    {
      get
      {
        return _pageSettings;
      }
      set
      {
        _pageSettings = value;
      }
    }


    [XmlAttribute("selected")]
    [DefaultValue("none")]
    public string Selected
    {
      get
      {
        return _selected;
      }
      set
      {
        _selected = value;
      }
    }


    [XmlAttribute("style")]
    public string Style
    {
      get
      {
        return _style;
      }
      set
      {
        _style = value;
      }
    }


    [XmlElement("TagDef")]
    public NotesNodeCollection<TagDef> TagDef
    {
      get
      {
        return _tagDef;
      }
    }


    public Title Title
    {
      get
      {
        return _title;
      }
      set
      {
        _title = value;
      }
    }



    #endregion


    #region Methods



    public List<INotesChange> UpdateContents()
    {
      Page pageWithContent = OneNote.GetPageContent(this);

      _updateContents = true;

      List<INotesChange> changes = UpdateAndGetChanges(pageWithContent);

      _updateContents = false;

      return changes;
    }



    #endregion


#if GENERATOR
    protected override bool UpdateSpecificContents(NotesHierarchyNode node, List<INotesChange> changes)
    {
      throw new NotImplementedException();
    }
#endif
  }
}